<?php
/**
 * Opencart 1.5.0.x tnt2011 Post module
 *
 * @version $Id$ = 1.5.0.x
 * 3 mei 2011 Gerrit Bouweriks voor Opencart 1.5.0.x
 */
class ModelShippingTNT2011 extends Model {
	function getQuote($address)
	{
		$this->load->language('shipping/tnt2011');

		if ($this->config->get('tnt2011_status')) {
			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('tnt2011_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");

			if (!$this->config->get('tnt2011_geo_zone_id')) {
							$status = true;
			} elseif ($query->num_rows) {
							$status = true;
			} else {
							$status = false;
			}
		} else {
			$status = false;
		}

		if ($this->config->get('tnt2011_use_freeshipping')) {
			if ($address['iso_code_2'] === 'NL') {
				if ($this->cart->getSubTotal() > $this->config->get('free_total')) {
					$status = false;
				}
			}
		}

		$verzendkosten = 0;
		$error = FALSE;
		$quote_data = array();

		if ($status) {
			$weight = floatval($this->weight->convert($this->cart->getWeight(), $this->config->get('config_weight_class'), 'g'));
			if ($weight >= 1000) {
				$show_weight = floatval($this->weight->convert($this->cart->getWeight(), $this->config->get('config_weight_class'), 'kg'));
				$kg = $this->language->get('text_showweight_kilo');

			}
			if ($weight < 1000) {
				$show_weight = floatval($this->weight->convert($this->cart->getWeight(), $this->config->get('config_weight_class'), 'g'));
				$kg = $this->language->get('text_showweight_gram');

			}

			// subtotaal van het karretje exclusief BTW
			$sub_total = $this->cart->getSubTotal();
			// Maximale waarde voor briefpost
			$max_waarde = intval($this->config->get('tnt2011_max_briefwaarde'));
			if ($max_waarde == 0 || $max_waarde == '') {
				$max_waarde = 999;
			}
			// Maximale waarde voor onverzekerde pakketpost
			$max_pakketwaarde = intval($this->config->get('tnt2011_max_pakketwaarde'));
			if ($max_pakketwaarde == 0 || $max_pakketwaarde == '') {
				$max_pakketwaarde = 999;
			}

			// vanaf hier kijken naar het totale verzend formaat
			$tntpost_width = 0;
			$tntpost_height = 0;
			$tntpost_length = 0;
			$tntbox = FALSE;

			foreach ($this->cart->getProducts() as $cartitem) {
				if($cartitem['length_class'] != 'mm') {
					if($cartitem['width'] != 0) {
						$cartitem['width'] = $this->length->convert($cartitem['width'], $cartitem['length_class'], 'mm');
					}

					if($cartitem['height'] != 0) {
						$cartitem['height'] = $this->length->convert($cartitem['height'], $cartitem['length_class'], 'mm');
					}

					if($cartitem['length'] != 0) {
						$cartitem['length'] = $this->length->convert($cartitem['length'], $cartitem['length_class'], 'mm');
					}
				}

				if($cartitem['width'] == '') { $cartitem['width'] = 266;}
				if($cartitem['height'] == '') { $cartitem['height'] = 33;}
				if($cartitem['length'] == '') { $cartitem['length'] = 381;}

				if($cartitem['width'] == 0) { $cartitem['width'] = 266;}
				if($cartitem['height'] == 0) { $cartitem['height'] = 33;}
				if($cartitem['length'] == 0) { $cartitem['length'] = 381;}

			}

			if ($this->cart->countProducts() == 1) {
				$tntpost_width += intval($cartitem['width']);
				$tntpost_height += intval($cartitem['height']);
				$tntpost_length += intval($cartitem['length']);

			} else if ($this->cart->countProducts() > 1) {
				$tntpost_width += intval($cartitem['width'] * $cartitem['quantity']);
				$tntpost_height += intval($cartitem['height'] * $cartitem['quantity']);
				$tntpost_length += intval($cartitem['length'] * $cartitem['quantity']);
			}

			if ($tntpost_width <= 265 || $tntpost_height <= 32 || $tntpost_length <= 380) {
				if ($weight > 2000 || $sub_total > $max_waarde) {
					$tntbox = 0; // doos
				} else {
					$tntbox = 1; // brief
				}
			}

			if ($tntpost_width > 265 && $tntpost_height > 32 && $tntpost_length > 380){
				$tntbox = 0; // doos
			}
			// eind formaat bepaling

			// Brievenpost NL
			if ($this->config->get('tnt2011_briefpost_nl_rb01') && $address['iso_code_2'] == 'NL' && $weight <= 2000 && $tntbox == 1) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_nl');
				$title = $this->language->get('text_tnt2011_briefpost_nl');

				$discount_tnt = 0;
				$tnt2011_discount_nl_std = $this->config->get('tnt2011_discount_nl_std');

				if ($weight > 0 && $weight <= 20) {
					if (isset($tnt2011_discount_nl_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_20');
					}
				}

				if ($weight > 20 && $weight <= 50) {
					if (isset($tnt2011_discount_nl_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_50');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_50');
					}
				}

				if ($weight > 50 && $weight <= 100) {
					if (isset($tnt2011_discount_nl_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_100');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_100');
					}
				}

				if ($weight > 100 && $weight <= 250) {
					if (isset($tnt2011_discount_nl_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_250');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_250');
					}
				}

				if ($weight > 250 && $weight <= 500) {
					if (isset($tnt2011_discount_nl_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_500');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_500');
					}
				}

				if ($weight > 500 && $weight <= 2000) {
					if (isset($tnt2011_discount_nl_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_2000');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_nl_2000');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}

				$quote_data['tnt2011_briefpost_nl'] = array(
					'code' => 'tnt2011.tnt2011_briefpost_nl',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}
			// Brievenpost Aantekenen_NL
			if ($this->config->get('tnt2011_briefpost_nl_rb02') && $address['iso_code_2'] == 'NL' && $weight <= 2000 && $tntbox == 1) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_nl');
				$title = $this->language->get('text_tnt2011_briefpost_aantekenen_nl');

				$discount_tnt = 0;
				$tnt2011_discount_nl_aan = $this->config->get('tnt2011_discount_nl_aan');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_nl_aan)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_aantekenen_nl_2000');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_aantekenen_nl_2000');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}


				$quote_data['tnt2011_briefpost_aantekenen_nl'] = array(
					'code' => 'tnt2011.tnt2011_briefpost_aantekenen_nl',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Brievenpost Rembours NL
			if ($this->config->get('tnt2011_briefpost_nl_rb03') && $address['iso_code_2'] == 'NL' && $weight <= 2000 && $tntbox == 1) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_nl');
				$title = $this->language->get('text_tnt2011_briefpost_rembours_nl');

				$discount_tnt = 0;
				$tnt2011_discount_nl_rem = $this->config->get('tnt2011_discount_nl_rem');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_nl_rem)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_rembours_nl_2000');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_rem;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_rembours_nl_2000');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}


				$quote_data['tnt2011_briefpost_rembours_nl'] = array(
					'code' => 'tnt2011.tnt2011_briefpost_rembours_nl',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// brievenpost Europa
			$countries = explode(',', 'BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE,BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ,AL,AD,CH,
									   VA,CY,BY,GI,GR,GL,IS,JE,HR,LI,MD,ME,MK,MT,NO,UA,SM,RS,TR,IM,GG,BA,FO');

			if ($this->config->get('tnt2011_briefpost_eu_rb01') && $weight <= 2000 && $tntbox == 1 && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_nl');
				$title = $this->language->get('text_tnt2011_briefpost_eu');

				$discount_tnt = 0;
				$tnt2011_discount_eu1_std = $this->config->get('tnt2011_discount_eu1_std');

				if ($weight > 0 && $weight <= 20) {
					if (isset($tnt2011_discount_eu1_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_20');
					}
				}

				if ($weight > 20 && $weight <= 50) {
					if (isset($tnt2011_discount_eu1_01)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_50');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_01;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_50');
					}
				}

				if ($weight > 50 && $weight <= 100) {
					if (isset($tnt2011_discount_eu1_01)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_100');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_01;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_100');
					}
				}

				if ($weight > 100 && $weight <= 250) {
					if (isset($tnt2011_discount_eu1_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_250');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_250');
					}
				}

				if ($weight > 250 && $weight <= 500) {
					if (isset($tnt2011_discount_eu1_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_500');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_500');
					}
				}

				if ($weight > 500 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu1_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_2000');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_eu_2000');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}


				$quote_data['tnt2011_briefpost_eu'] = array(
					'code' => 'tnt2011.tnt2011_briefpost_eu',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Brievenpost aantekenen Europa
			$countries = explode(',', 'BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE,BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ,AL,AD,CH,
						   VA,CY,BY,GI,GR,GL,IS,JE,HR,LI,MD,ME,MK,MT,NO,UA,SM,RS,TR,IM,GG,BA,FO');

			if ($this->config->get('tnt2011_briefpost_eu_rb02') && $weight <= 2000 && $tntbox == 1 && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_nl');
				$title = $this->language->get('text_tnt2011_briefpost_aantekenen_eu');

				$discount_tnt = 0;
				$tnt2011_discount_eu1_aan = $this->config->get('tnt2011_discount_eu1_aan');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu1_aan)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_aantekenen_eu_2000');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_aantekenen_eu_2000');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}


				$quote_data['tnt2011_briefpost_aantekenen_eu'] = array(
					'code' => 'tnt2011.tnt2011_briefpost_aantekenen_eu',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Brievenpost Rest of World
			$countries = explode(',', 'BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE,BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ,AL,AD,CH,
									   VA,CY,BY,GI,GR,GL,IS,JE,HR,LI,MD,ME,MK,MT,NO,UA,SM,RS,TR,IM,GG,BA,FO,NL');

			if ($this->config->get('tnt2011_briefpost_row_rb01') && $weight <= 2000 && $tntbox == 1 && !(in_array($address['iso_code_2'], $countries))) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_nl');
				$title = $this->language->get('text_tnt2011_briefpost_row');

				$discount_tnt = 0;
				$tnt2011_discount_world_std = $this->config->get('$tnt2011_discount_world_std');


				if ($weight > 0 && $weight <= 20) {
					if (isset($tnt2011_discount_world_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_20');
					}
				}

				if ($weight > 20 && $weight <= 50) {
					if (isset($tnt2011_discount_world_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_50');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_50');
					}
				}

				if ($weight > 50 && $weight <= 100) {
					if (isset($tnt2011_discount_world_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_100');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_100');
					}
				}

				if ($weight > 100 && $weight <= 250) {
					if (isset($tnt2011_discount_world_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_250');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_250');
					}
				}

				if ($weight > 250 && $weight <= 500) {
					if (isset($tnt2011_discount_world_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_500');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_500');
					}
				}

				if ($weight > 500 && $weight <= 2000) {
					if (isset($tnt2011_discount_world_std)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_2000');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_row_2000');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}


				$quote_data['tnt2011_briefpost_row'] = array(
					'code' => 'tnt2011.tnt2011_briefpost_row',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Brievenpost aantekenen Rest of World
			$countries = explode(',', 'BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE,BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ,AL,AD,CH,
						   VA,CY,BY,GI,GR,GL,IS,JE,HR,LI,MD,ME,MK,MT,NO,UA,SM,RS,TR,IM,GG,BA,FO,NL');

			if ($this->config->get('tnt2011_briefpost_row_rb02') && $weight <= 2000 && $tntbox == 1 && !in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_nl');
				$title = $this->language->get('text_tnt2011_briefpost_aantekenen_row');

				$discount_tnt = 0;
				$tnt2011_discount_world_aan = $this->config->get('tnt2011_discount_world_aan');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_world_aan)) {
						$verzendkosten = $this->config->get('tnt2011_briefpost_aantekenen_row_2000');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_briefpost_aantekenen_row_2000');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}

				$quote_data['tnt2011_briefpost_aantekenen_row'] = array(
					'code' => 'tnt2011.tnt2011_briefpost_aantekenen_row',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Nederland Parcel
			if ($this->config->get('tnt2011_nl_rb01') && $address['iso_code_2'] == 'NL' && $tntbox == 0 && $sub_total <= $max_pakketwaarde) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_nl');
				$title = $this->language->get('text_tnt2011_nl');

				$discount_tnt = 0;
				$tnt2011_discount_nl_parcel_std = $this->config->get('tnt2011_discount_nl_parcel_std');

				if ($weight > 0 && $weight <= 10000) {
					if (isset($tnt2011_discount_nl_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_nl_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_nl_10');
					}
				}

				if ($weight > 10000 && $weight <= 30000) {
					if (isset($tnt2011_discount_nl_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_nl_30');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_nl_30');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 30000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}


				$quote_data['tnt2011_nl'] = array(
					'code' => 'tnt2011.tnt2011_nl',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

				// Nederland met Aantekenen
				if ($this->config->get('tnt2011_nl_rb02') && $address['iso_code_2'] == 'NL' && $tntbox == 0) {
					$cost = 0;

					$title_tnt2011 = $this->language->get('text_title_nl');
					$title = $this->language->get('text_tnt2011_nl_aantekenen');

					$discount_tnt = 0;
					$tnt2011_discount_nl_parcel_aan = $this->config->get('tnt2011_discount_nl_parcel_aan');

					if ($weight > 0 && $weight <= 10000) {
						if (isset($tnt2011_discount_nl_parcel_aan)) {
							$verzendkosten = $this->config->get('tnt2011_nl_aantekenen_10');
							$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_aan;
							$verzendkosten = $verzendkosten - $discount_tnt;
						} else {
							$verzendkosten = $this->config->get('tnt2011_nl_aantekenen_10');
						}
					}

					if ($weight > 10000 && $weight <= 30000) {
						if (isset($tnt2011_discount_nl_parcel_aan)) {
							$verzendkosten = $this->config->get('tnt2011_nl_aantekenen_30');
							$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_aan;
							$verzendkosten = $verzendkosten - $discount_tnt;
						} else {
							$verzendkosten = $this->config->get('tnt2011_nl_aantekenen_30');
						}
					}

					if ($weight <= 0) {
						$error = $this->language->get('error_zero_weight');
					}

					if ($weight > 30000) {
						$error = $this->language->get('error_over_weight');
					}

					if ($this->config->get('tnt2011_display_weight')) {
						$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
					}

					if ($this->config->get('tnt2011_display_time')) {
						$title .= $this->language->get('text_eta_next_day');
					}

					$quote_data['tnt2011_nl_aantekenen'] = array(
						'code' => 'tnt2011.tnt2011_nl_aantekenen',
						'title' => $title,
						'cost' => $verzendkosten,
						'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
						'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
						);
				}

				// Nederland met Verzekering
				if ($this->config->get('tnt2011_nl_rb03') && $address['iso_code_2'] == 'NL' && $tntbox == 0) {
					$cost = 0;

					$title_tnt2011 = $this->language->get('text_title_nl');
					$title = $this->language->get('text_tnt2011_nl_verzekerd');

					$discount_tnt = 0;
					$tnt2011_discount_nl_parcel_ver = $this->config->get('tnt2011_discount_nl_parcel_ver');

					if ($weight > 0 && $weight <= 10000) {
						if (isset($tnt2011_discount_nl_parcel_ver)) {
							$verzendkosten = $this->config->get('tnt2011_nl_verzekerd_10');
							$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_ver;
							$verzendkosten = $verzendkosten - $discount_tnt;
						} else {
							$verzendkosten = $this->config->get('tnt2011_nl_verzekerd_10');
						}
					}

					if ($weight > 10000 && $weight <= 30000) {
						if (isset($tnt2011_discount_nl_parcel_ver)) {
							$verzendkosten = $this->config->get('tnt2011_nl_verzekerd_30');
							$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_ver;
							$verzendkosten = $verzendkosten - $discount_tnt;
						} else {
							$verzendkosten = $this->config->get('tnt2011_nl_verzekerd_30');
						}
					}

					if ($weight <= 0) {
						$error = $this->language->get('error_zero_weight');
					}

					if ($weight > 30000) {
						$error = $this->language->get('error_over_weight');
					}

					if ($this->config->get('tnt2011_display_weight')) {
						$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
					}

					if ($this->config->get('tnt2011_display_time')) {
						$title .= $this->language->get('text_eta_next_day');
					}

					$quote_data['tnt2011_nl_verzekerd'] = array(
						'code' => 'tnt2011.tnt2011_nl_verzekerd',
						'title' => $title,
						'cost' => $verzendkosten,
						'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
						'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
						);
				}

				// Nederland Rembours
				if ($this->config->get('tnt2011_nl_rb04') && $address['iso_code_2'] == 'NL' && $tntbox == 0) {
					$cost = 0;

					$title_tnt2011 = $this->language->get('text_title_nl');
					$title = $this->language->get('text_tnt2011_nl_rembours');

					$discount_tnt = 0;
					$tnt2011_discount_nl_parcel_rem = $this->config->get('tnt2011_discount_nl_parcel_rem');

					if ($weight > 0 && $weight <= 10000) {
						if (isset($tnt2011_discount_nl_parcel_rem)) {
							$verzendkosten = $this->config->get('tnt2011_nl_rembours_10');
							$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_rem;
							$verzendkosten = $verzendkosten - $discount_tnt;
						} else {
							$verzendkosten = $this->config->get('tnt2011_nl_rembours_10');
						}
					}

					if ($weight > 10000 && $weight <= 30000) {
						if (isset($tnt2011_discount_nl_parcel_rem)) {
							$verzendkosten = $this->config->get('tnt2011_nl_rembours_30');
							$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_rem;
							$verzendkosten = $verzendkosten - $discount_tnt;
						} else {
							$verzendkosten = $this->config->get('tnt2011_nl_rembours_30');
						}
					}

					if ($weight <= 0) {
						$error = $this->language->get('error_zero_weight');
					}

					if ($weight > 30000) {
						$error = $this->language->get('error_over_weight');
					}

					if ($this->config->get('tnt2011_display_weight')) {
						$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
					}

					if ($this->config->get('tnt2011_display_time')) {
						$title .= $this->language->get('text_eta_next_day');
					}


					$quote_data['tnt2011_nl_rembours'] = array(
						'code' => 'tnt2011.tnt2011_nl_rembours',
						'title' => $title,
						'cost' => $verzendkosten,
						'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
						'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
						);
				}

			// Nederland Spoedbestelling
				if ($this->config->get('tnt2011_nl_rb05') && $weight <=10000 && $address['iso_code_2'] == 'NL' && $tntbox == 0) {
					$cost = 0;

					$title_tnt2011 = $this->language->get('text_title_nl');
					$title = $this->language->get('text_tnt2011_nl_spoed');

					$discount_tnt = 0;
					$tnt2011_discount_nl_parcel_spoed = $this->config->get('tnt2011_discount_nl_parcel_spoed');

					if ($weight > 0 && $weight <= 2000) {
						if (isset($tnt2011_discount_nl_parcel_spoed)) {
							$verzendkosten = $this->config->get('tnt2011_nl_spoed_02');
							$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_spoed;
							$verzendkosten = $verzendkosten - $discount_tnt;
						} else {
							$verzendkosten = $this->config->get('tnt2011_nl_spoed_02');
						}
					}

					if ($weight > 2000 && $weight <= 5000) {
						if (isset($tnt2011_discount_nl_parcel_spoed)) {
							$verzendkosten = $this->config->get('tnt2011_nl_spoed_05');
							$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_spoed;
							$verzendkosten = $verzendkosten - $discount_tnt;
						} else {
							$verzendkosten = $this->config->get('tnt2011_nl_spoed_05');
						}
					}

					if ($weight > 5000 && $weight <= 10000) {
						if (isset($tnt2011_discount_nl_parcel_spoed)) {
							$verzendkosten = $this->config->get('tnt2011_nl_spoed_10');
							$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_nl_parcel_spoed;
							$verzendkosten = $verzendkosten - $discount_tnt;
						} else {
							$verzendkosten = $this->config->get('tnt2011_nl_spoed_10');
						}
					}


					if ($weight <= 0) {
						$error = $this->language->get('error_zero_weight');
					}

					if ($weight > 10000) {
						$error = $this->language->get('error_over_weight');
					}

					if ($this->config->get('tnt2011_display_weight')) {
						$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
					}

					if ($this->config->get('tnt2011_display_time')) {
						$title .= $this->language->get('text_eta_next_day');
					}


					$quote_data['tnt2011_nl_spoed'] = array(
						'code' => 'tnt2011.tnt2011_nl_spoed',
						'title' => $title,
						'cost' => $verzendkosten,
						'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
						'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
						);
				}

			// Europa I Pakketservice
			$countries = explode(',', 'BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE');

			if ($this->config->get('tnt2011_eu1_rb01') && $weight <=30000 && $tntbox == 0 && $sub_total <= $max_pakketwaarde && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu1');
				$title = $this->language->get('text_tnt2011_eu1');

				$discount_tnt = 0;
				$tnt2011_discount_eu1_parcel_std = $this->config->get('tnt2011_discount_eu1_parcel_std');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu1_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu1_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu1_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_eu1_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_20');
					}				}

				if ($weight > 20000 && $weight <= 30000) {
					if (isset($tnt2011_discount_eu1_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_30');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_30');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 30000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}

				$quote_data['tnt2011_eu1'] = array(
					'code' => 'tnt2011.tnt2011_eu1',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}


			// Europa I met Aantekenen
			$countries = explode(',', 'BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE');

			if ($this->config->get('tnt2011_eu1_rb02') && $weight <=30000 && $tntbox == 0 && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu1');
				$title = $this->language->get('text_tnt2011_eu1_aantekenen');

				$discount_tnt = 0;
				$tnt2011_discount_eu1_parcel_aan = $this->config->get('tnt2011_discount_eu1_parcel_aan');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu1_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_aantekenen_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_aantekenen_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu1_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_aantekenen_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_aantekenen_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu1_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_aantekenen_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_aantekenen_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_eu1_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_aantekenen_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_aantekenen_20');
					}
				}

				if ($weight > 20000 && $weight <= 30000) {
					if (isset($tnt2011_discount_eu1_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_aantekenen_30');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_aantekenen_30');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 30000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {

					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}

				$quote_data['tnt2011_eu1_aantekenen'] = array(
					'code' => 'tnt2011.tnt2011_eu1_aantekenen',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Europa I met Verzekering
			$countries = explode(',', 'BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE');

			if ($this->config->get('tnt2011_eu1_rb03') && $weight <=30000 && $tntbox == 0 && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu1');
				$title = $this->language->get('text_tnt2011_eu1_verzekerd');

				$discount_tnt = 0;
				$tnt2011_discount_eu1_parcel_ver = $this->config->get('tnt2011_discount_eu1_parcel_ver');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu1_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_verzekerd_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_verzekerd_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu1_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_verzekerd_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_verzekerd_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu1_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_verzekerd_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_verzekerd_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_eu1_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_verzekerd_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_verzekerd_20');
					}
				}

				if ($weight > 20000 && $weight <= 30000) {
					if (isset($tnt2011_discount_eu1_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_verzekerd_30');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_verzekerd_30');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 30000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}

				$quote_data['tnt2011_eu1_verzekerd'] = array(
					'code' => 'tnt2011.tnt2011_eu1_verzekerd',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

//			// Europa I Spoedbestelling
			$countries = explode(',', 'BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE');

			if ($this->config->get('tnt2011_eu1_rb05') && $weight <=10000 && $tntbox == 0 && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu1');
				$title = $this->language->get('text_tnt2011_eu1_spoed');

				$discount_tnt = 0;
				$tnt2011_discount_eu1_parcel_spoed = $this->config->get('tnt2011_discount_eu1_parcel_spoed');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu1_parcel_spoed)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_spoed_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_spoed;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_spoed_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu1_parcel_spoed)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_spoed_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_spoed;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_spoed_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu1_parcel_spoed)) {
						$verzendkosten = $this->config->get('tnt2011_eu1_spoed_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu1_parcel_spoed;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu1_spoed_10');
					}
				}


				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 10000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_next_day');
				}

				$quote_data['tnt2011_eu1_spoed'] = array(
					'code' => 'tnt2011.tnt2011_eu1_spoed',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}


			// Europa II Pakketservice
			$countries = explode(',', 'BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ');

			if ($this->config->get('tnt2011_eu2_rb01') && $weight <=30000 && $tntbox == 0 && $sub_total <= $max_pakketwaarde && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu2');
				$title = $this->language->get('text_tnt2011_eu2');

				$discount_tnt = 0;
				$tnt2011_discount_eu2_parcel_std = $this->config->get('tnt2011_discount_eu2_parcel_std');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu2_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu2_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu2_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_eu2_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_20');
					}
				}

				if ($weight > 20000 && $weight <= 30000) {
					if (isset($tnt2011_discount_eu2_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_30');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_30');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 30000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_three');
				}

				$quote_data['tnt2011_eu2'] = array(
					'code' => 'tnt2011.tnt2011_eu2',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}


			// Europa II met Aantekenen
			$countries = explode(',', 'BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ');

			if ($this->config->get('tnt2011_eu2_rb02') && $weight <=30000 && $tntbox == 0 && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu2');
				$title = $this->language->get('text_tnt2011_eu2_aantekenen');

				$discount_tnt = 0;
				$tnt2011_discount_eu2_parcel_aan = $this->config->get('tnt2011_discount_eu2_parcel_aan');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu2_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_aantekenen_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_aantekenen_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu2_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_aantekenen_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_aantekenen_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu2_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_aantekenen_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_aantekenen_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_eu2_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_aantekenen_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_aantekenen_20');
					}
				}

				if ($weight > 20000 && $weight <= 30000) {
					if (isset($tnt2011_discount_eu2_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_aantekenen_30');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_aantekenen_30');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 30000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_three');
				}

				$quote_data['tnt2011_eu2_aantekenen'] = array(
					'code' => 'tnt2011.tnt2011_eu2_aantekenen',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Europa II met Verzekering
			$countries = explode(',', 'BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ');

			if ($this->config->get('tnt2011_eu2_rb03') && $weight <=30000 && $tntbox == 0 && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu2');
				$title = $this->language->get('text_tnt2011_eu2_verzekerd');

				$discount_tnt = 0;
				$tnt2011_discount_eu2_parcel_ver = $this->config->get('tnt2011_discount_eu2_parcel_ver');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu2_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_verzekerd_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_verzekerd_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu2_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_verzekerd_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_verzekerd_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu2_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_verzekerd_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_verzekerd_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_eu2_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_verzekerd_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_verzekerd_20');
					}
				}

				if ($weight > 20000 && $weight <= 30000) {
					if (isset($tnt2011_discount_eu2_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_verzekerd_30');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_verzekerd_30');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 30000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_three');
				}

				$quote_data['tnt2011_eu2_verzekerd'] = array(
					'code' => 'tnt2011.tnt2011_eu2_verzekerd',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Europa II Spoedbestelling
			$countries = explode(',', 'BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ');

			if ($this->config->get('tnt2011_eu2_rb05') && $weight <=10000 && $tntbox == 0  && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu2');
				$title = $this->language->get('text_tnt2011_eu2_spoed');

				$discount_tnt = 0;
				$tnt2011_discount_eu2_parcel_spoed = $this->config->get('tnt2011_discount_eu2_parcel_spoed');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu2_parcel_spoed)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_spoed_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_spoed;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_spoed_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu2_parcel_spoed)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_spoed_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_spoed;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_spoed_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu2_parcel_spoed)) {
						$verzendkosten = $this->config->get('tnt2011_eu2_spoed_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu2_parcel_spoed;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu2_spoed_10');
					}
				}


				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 10000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_three');
				}

				$quote_data['tnt2011_eu2_spoed'] = array(
					'code' => 'tnt2011.tnt2011_eu2_spoed',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Europa III Pakketservice
			$countries = explode(',', 'AL,AD,CH,VA,CY,BY,GI,GR,GL,IS,JE,HR,LI,MD,ME,MK,MT,NO,UA,SM,RS,TR,IM,GG,BA,FO');

			if ($this->config->get('tnt2011_eu3_rb01') && $weight <=20000 && $tntbox == 0 && $sub_total <= $max_pakketwaarde && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu3');
				$title = $this->language->get('text_tnt2011_eu3');

				$discount_tnt = 0;
				$tnt2011_discount_eu3_parcel_std = $this->config->get('tnt2011_discount_eu3_parcel_std');


				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu3_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu3_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu3_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_eu3_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_20');
					}
				}


				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 20000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_five');
				}

				$quote_data['tnt2011_eu3'] = array(
					'code' => 'tnt2011.tnt2011_eu3',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}


			// Europa III met Aantekenen
			$countries = explode(',', 'AL,AD,CH,VA,CY,BY,GI,GR,GL,IS,JE,HR,LI,MD,ME,MK,MT,NO,UA,SM,RS,TR,IM,GG,BA,FO');

			if ($this->config->get('tnt2011_eu3_rb02') && $weight <=20000 && $tntbox == 0 && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu3');
				$title = $this->language->get('text_tnt2011_eu3_aantekenen');

				$discount_tnt = 0;
				$tnt2011_discount_eu3_parcel_aan = $this->config->get('tnt2011_discount_eu3_parcel_aan');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu3_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_aantekenen_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_aantekenen_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu3_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_aantekenen_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_aantekenen_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu3_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_aantekenen_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_aantekenen_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_eu3_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_aantekenen_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_aantekenen_20');
					}
				}


				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 20000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_five');
				}

				$quote_data['tnt2011_eu3_aantekenen'] = array(
					'code' => 'tnt2011.tnt2011_eu3_aantekenen',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Europa III met Verzekering
			$countries = explode(',', 'AL,AD,CH,VA,CY,BY,GI,GR,GL,IS,JE,HR,LI,MD,ME,MK,MT,NO,UA,SM,RS,TR,IM,GG,BA,FO');

			if ($this->config->get('tnt2011_eu3_rb03') && $weight <=20000 && $tntbox == 0 && in_array($address['iso_code_2'], $countries)) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_eu3');
				$title = $this->language->get('text_tnt2011_eu3_verzekerd');

				$discount_tnt = 0;
				$tnt2011_discount_eu3_parcel_ver = $this->config->get('tnt2011_discount_eu3_parcel_ver');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_eu3_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_verzekerd_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_verzekerd_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_eu3_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_verzekerd_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_verzekerd_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_eu3_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_verzekerd_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_verzekerd_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_eu3_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_eu3_verzekerd_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_eu3_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_eu3_verzekerd_20');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 20000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_five');
				}

				$quote_data['tnt2011_eu3_verzekerd'] = array(
					'code' => 'tnt2011.tnt2011_eu3_verzekerd',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Rest van de wereld Pakketservice
			$countries = explode(',', 'NL,BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE,BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ,
									   AL,AD,CH,VA,CY,BY,GI,GR,GL,IS,JE,HR,LI,MD,ME,MK,MT,NO,UA,SM,RS,TR,IM,GG,BA,FO');

			if ($this->config->get('tnt2011_wereld_rb01') && $weight <=20000 && $tntbox == 0 && $sub_total <= $max_pakketwaarde && !(in_array($address['iso_code_2'], $countries))) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_wereld');
				$title = $this->language->get('text_tnt2011_wereld');

				$discount_tnt = 0;
				$tnt2011_discount_world_parcel_std = $this->config->get('tnt2011_discount_world_parcel_std');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_world_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_world_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_world_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_102');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_world_parcel_std)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_std;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_20');
					}
				}


				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 20000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_ten');
				}

				$quote_data['tnt2011_wereld'] = array(
					'code' => 'tnt2011.tnt2011_wereld',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}


			// Rest van de wereld met Aantekenen
			$countries = explode(',', 'NL,BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE,BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ,
						   AL,AD,CH,VA,CY,BY,GI,GR,GL,IS,JE,HR,LI,MD,ME,MK,MT,NO,UA,SM,RS,TR,IM,GG,BA,FO');

			if ($this->config->get('tnt2011_wereld_rb02') && $weight <=20000 && $tntbox == 0 && !(in_array($address['iso_code_2'], $countries))) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_wereld');
				$title = $this->language->get('text_tnt2011_wereld_aantekenen');

				$discount_tnt = 0;
				$tnt2011_discount_world_parcel_aan = $this->config->get('tnt2011_discount_world_parcel_aan');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_world_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_aantekenen_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_aantekenen_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_world_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_aantekenen_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_aantekenen_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_world_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_aantekenen_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_aantekenen_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_world_parcel_aan)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_aantekenen_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_aan;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_aantekenen_20');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 20000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_ten');
				}

				$quote_data['tnt2011_wereld_aantekenen'] = array(
					'code' => 'tnt2011.tnt2011_wereld_aantekenen',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

			// Rest van de wereld met Verzekering
			$countries = explode(',', 'NL,BE,DK,DE,FR,IT,LU,MC,AT,ES,GB,SE,BG,EE,FI,HU,IE,LV,LT,PL,PT,RO,SI,SK,CZ,
						   AL,AD,CH,VA,CY,BY,GI,GR,GL,IS,JE,HR,LI,MD,ME,MK,MT,NO,UA,SM,RS,TR,IM,GG,BA,FO');

			if ($this->config->get('tnt2011_wereld_rb03') && $weight <=20000 && $tntbox == 0 && !(in_array($address['iso_code_2'], $countries))) {
				$cost = 0;

				$title_tnt2011 = $this->language->get('text_title_wereld');
				$title = $this->language->get('text_tnt2011_wereld_verzekerd');

				$discount_tnt = 0;
				$tnt2011_discount_world_parcel_ver = $this->config->get('tnt2011_discount_world_parcel_ver');

				if ($weight > 0 && $weight <= 2000) {
					if (isset($tnt2011_discount_world_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_verzekerd_02');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_verzekerd_02');
					}
				}

				if ($weight > 2000 && $weight <= 5000) {
					if (isset($tnt2011_discount_world_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_verzekerd_05');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_verzekerd_05');
					}
				}

				if ($weight > 5000 && $weight <= 10000) {
					if (isset($tnt2011_discount_world_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_verzekerd_10');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_verzekerd_10');
					}
				}

				if ($weight > 10000 && $weight <= 20000) {
					if (isset($tnt2011_discount_world_parcel_ver)) {
						$verzendkosten = $this->config->get('tnt2011_wereld_verzekerd_20');
						$discount_tnt = ($verzendkosten / 100) * $tnt2011_discount_world_parcel_ver;
						$verzendkosten = $verzendkosten - $discount_tnt;
					} else {
						$verzendkosten = $this->config->get('tnt2011_wereld_verzekerd_20');
					}
				}

				if ($weight <= 0) {
					$error = $this->language->get('error_zero_weight');
				}

				if ($weight > 20000) {
					$error = $this->language->get('error_over_weight');
				}

				if ($this->config->get('tnt2011_display_weight')) {
					$title .= '<span class="help">' . $this->language->get('text_weight') . ' ' . $show_weight . ' ' . $kg . '</span>';
				}

				if ($this->config->get('tnt2011_display_time')) {
					$title .= $this->language->get('text_eta_ten');
				}

				$quote_data['tnt2011_wereld_verzekerd'] = array(
					'code' => 'tnt2011.tnt2011_wereld_verzekerd',
					'title' => $title,
					'cost' => $verzendkosten,
					'tax_class_id' => $this->config->get('tnt2011_tax_class_id'),
					'text' => $this->currency->format($this->tax->calculate($verzendkosten, $this->config->get('tnt2011_tax_class_id'), $this->config->get('config_tax')))
					);
			}

		}

		$method_data = array();

		if ($quote_data) {
			$method_data = array(
				'code' => 'tnt2011',
				'title' => $title_tnt2011,
				'quote' => $quote_data,
				'sort_order' => $this->config->get('tnt2011_sort_order'),
				'error' => $error
				);
		}
		return $method_data;
	}
}
?>